Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(alerts&reports): Alerts & Reports will use values from WEBDRIVER_WINDOW option #13157

Merged
merged 6 commits into from
Mar 2, 2021
Merged

fix(alerts&reports): Alerts & Reports will use values from WEBDRIVER_WINDOW option #13157

merged 6 commits into from
Mar 2, 2021

Conversation

iercan
Copy link
Contributor

@iercan iercan commented Feb 16, 2021

SUMMARY

This PR resolves #13097
This improvement make thumbnails and new reports module uses WEBDRIVER_WINDOW option from config.

I defined init function to screenshot object to pass window_size and thumb_size same value for reports so that images will not be shrink . Before It was using harcoded 800x600 value which is defined for thumbnails.

TEST PLAN

Create alert and reports. Images should be sent same size defined with WEBDRIVER_WINDOW

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@dpgaspar
Copy link
Member

@iercan thank you for the fix, I restarted CI jobs. But you need to take care of:
https://github.com/apache/superset/pull/13157/checks?check_run_id=1912529461

you can run locally:

git add -u
pre-commit

@iercan
Copy link
Contributor Author

iercan commented Feb 17, 2021

@dpgaspar I executed the commands on my branch. What it is doing?

@junlincc junlincc added the new:contributor The author is a new contributor label Feb 17, 2021
@dpgaspar
Copy link
Member

@iercan it does a bunch of things, https://github.com/apache/superset/blob/master/.pre-commit-config.yaml
the most relevant are black, mypy, isort

Also take a look at:
https://github.com/apache/superset/blob/master/CONTRIBUTING.md

@iercan
Copy link
Contributor Author

iercan commented Feb 18, 2021

@dpgaspar so should I recommit and push my changes? or running pre-commit is just enough?

@iercan
Copy link
Contributor Author

iercan commented Feb 18, 2021

@dpgaspar oh I got it. It reformatted files. I had to run as pre-commit run --all-files

@codecov-io
Copy link

codecov-io commented Feb 18, 2021

Codecov Report

Merging #13157 (f4cec93) into master (e8857ba) will increase coverage by 0.41%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13157      +/-   ##
==========================================
+ Coverage   66.88%   67.30%   +0.41%     
==========================================
  Files        1021      497     -524     
  Lines       50015    29410   -20605     
  Branches     4907        0    -4907     
==========================================
- Hits        33455    19794   -13661     
+ Misses      16435     9616    -6819     
+ Partials      125        0     -125     
Flag Coverage Δ
cypress ?
hive 66.60% <ø> (?)
javascript ?
postgres 66.88% <ø> (?)
presto 66.63% <ø> (?)
python 67.30% <ø> (+3.21%) ⬆️
sqlite 66.58% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/utils/celery.py 89.65% <0.00%> (-10.35%) ⬇️
superset/utils/cache.py 76.34% <0.00%> (-8.77%) ⬇️
superset/dataframe.py 91.66% <0.00%> (-8.34%) ⬇️
superset/db_engine_specs/clickhouse.py 87.09% <0.00%> (-7.35%) ⬇️
superset/dashboards/commands/update.py 83.07% <0.00%> (-5.61%) ⬇️
superset/utils/decorators.py 94.44% <0.00%> (-5.56%) ⬇️
superset/reports/notifications/slack.py 83.72% <0.00%> (-5.47%) ⬇️
superset/connectors/sqla/views.py 62.43% <0.00%> (-4.76%) ⬇️
superset/db_engine_specs/elasticsearch.py 90.24% <0.00%> (-4.21%) ⬇️
superset/viz.py 56.28% <0.00%> (-2.78%) ⬇️
... and 539 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e8857ba...f4cec93. Read the comment docs.

@@ -946,7 +946,7 @@ class CeleryConfig: # pylint: disable=too-few-public-methods
WEBDRIVER_TYPE = "firefox"

# Window size - this will impact the rendering of the data
WEBDRIVER_WINDOW = {"dashboard": (1600, 2000), "slice": (3000, 1200)}
WEBDRIVER_WINDOW = {"dashboard": (1600, 3000), "slice": (1280, 960)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably a breaking change, why do we need it?

Copy link
Contributor Author

@iercan iercan Feb 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my tests too big slice resolution makes pictures blur too much. Here is result for 3000x1200 and 1280x960

image

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dpgaspar For the record. There will be no problem with reports because I provided same thumb_size and window_size for reports. But they still get so blur for thumbnails. I can revert this change if you want.

Copy link
Contributor Author

@iercan iercan Feb 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to revert that and provide old harcoded sizes for thumbnails so that caches will not be needed to recalculated again.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, better to change your PR description: Additional note: This PR will cause thumbnails recalculate because cache keys depends on window size.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed that part

@iercan iercan changed the title fix: Report and thumbnails will use values from WEBDRIVER_WINDOW option fix(alerts&reports): Alerts & Reports will use values from WEBDRIVER_WINDOW option Feb 19, 2021
@iercan iercan requested a review from dpgaspar February 22, 2021 20:27
defining defaults in thumbnails.py caused thumbnail caches invalidated.
they moved to init.
Copy link
Member

@dpgaspar dpgaspar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iercan, Although this is a bug, and this PR fixes it, it's also a breaking change. Starting to see the necessity to create 2 new config keys, one for thumbnails and another for reports, so that it's possible to configure both independently

@iercan
Copy link
Contributor Author

iercan commented Mar 1, 2021

@iercan, Although this is a bug, and this PR fixes it, it's also a breaking change. Starting to see the necessity to create 2 new config keys, one for thumbnails and another for reports, so that it's possible to configure both independently

Sure I can add 2 different options. But with final edit I made, I don't think it is a breaking change anymore. I kept thumbnails untouched and just reports will use webdriver window. Isn't WEBDRIVER_WINDOW meant to be used just for reports?

@dpgaspar
Copy link
Member

dpgaspar commented Mar 1, 2021

@iercan, Although this is a bug, and this PR fixes it, it's also a breaking change. Starting to see the necessity to create 2 new config keys, one for thumbnails and another for reports, so that it's possible to configure both independently

Sure I can add 2 different options. But with final edit I made, I don't think it is a breaking change anymore. I kept thumbnails untouched and just reports will use webdriver window. Isn't WEBDRIVER_WINDOW meant to be used just for reports?

it is, it's sort of a breaking change because the new reports will now change its image size. I think it would be more flexible to have the 2 new config keys. Let the new reports still take the screenshot with the previous size, but making it now possible for everyone to configure it

thoughts?

@iercan
Copy link
Contributor Author

iercan commented Mar 1, 2021

it is, it's sort of a breaking change because the new reports will now change its image size. I think it would be more flexible to have the 2 new config keys. Let the new reports still take the screenshot with the previous size, but making it now possible for everyone to configure it

thoughts?

I think adding 2 different config may get configuration more complicated from point of view of a user. Also I'm not sure thumbnail size should be configurable.

@dpgaspar
Copy link
Member

dpgaspar commented Mar 1, 2021

it is, it's sort of a breaking change because the new reports will now change its image size. I think it would be more flexible to have the 2 new config keys. Let the new reports still take the screenshot with the previous size, but making it now possible for everyone to configure it
thoughts?

I think adding 2 different config may get configuration more complicated from point of view of a user. Also I'm not sure thumbnail size should be configurable.

Good point, but still seems weird to me that by configuring WEBDRIVER_WINDOW we only end up configuring the new alerts & reports window, while thumbnails is hardcoded. Not explicit nor obvious. But this looks good, and I don't want to stale this fix for long. Thank you for your contribution and patience

@dpgaspar dpgaspar merged commit b04aebf into apache:master Mar 2, 2021
betodealmeida pushed a commit to betodealmeida/incubator-superset that referenced this pull request Mar 19, 2021
…WINDOW option (apache#13157)

* fix: thumbnails and reports will be use WEBDRIVER_WINDOW option

* changes reformatted

* config change reverted. thumbnails sizes changed to original

* typo fix

* bugfix

defining defaults in thumbnails.py caused thumbnail caches invalidated.
they moved to init.

Co-authored-by: Ibrahim Ercan <ibrahim.ercan@vlmedia.com.tr>
@iercan iercan mentioned this pull request Mar 26, 2021
6 tasks
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
…WINDOW option (apache#13157)

* fix: thumbnails and reports will be use WEBDRIVER_WINDOW option

* changes reformatted

* config change reverted. thumbnails sizes changed to original

* typo fix

* bugfix

defining defaults in thumbnails.py caused thumbnail caches invalidated.
they moved to init.

Co-authored-by: Ibrahim Ercan <ibrahim.ercan@vlmedia.com.tr>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels new:contributor The author is a new contributor size/M v1.1 🚢 1.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dashboard generated via report scheduling is truncated
7 participants